#include <string.h>
#include <stdio.h>

#define DEVSTR_MAX_LENGTH 64

struct DeviceInfo {
    int devId;

    char devname[DEVSTR_MAX_LENGTH];
    int nameLen;

    char devfileSys[DEVSTR_MAX_LENGTH];
    int fileSysLen;

    char devMntPoint[DEVSTR_MAX_LENGTH];
    int mntPointLen;

    DeviceInfo& operator=(const DeviceInfo& src)
    {
        this->devId = src.devId;
        this->nameLen = src.nameLen;
        this->fileSysLen = src.fileSysLen;
        this->mntPointLen = src.mntPointLen;

        memset(this->devname, 0, sizeof(this->devname));
        memset(this->devfileSys, 0, sizeof(this->devname));
        memset(this->devMntPoint, 0, sizeof(this->devname));
        strncpy(this->devname, src.devname, src.nameLen);
        strncpy(this->devfileSys, src.devfileSys, src.fileSysLen);
        strncpy(this->devMntPoint, src.devMntPoint, src.mntPointLen);
        return *this;
    }
};



int main()
{
    DeviceInfo b;
    b.devId = 3;
    strcpy(b.devname, "devicename");
    b.nameLen = strlen(b.devname);
    strcpy(b.devfileSys, "devfilesys");
    b.fileSysLen = strlen(b.devfileSys);
    strcpy(b.devMntPoint, "mount point");
    b.mntPointLen = strlen(b.devMntPoint);

    DeviceInfo a = b;
    printf("id: %d\nname: %s(%d)\nfile sys: %s(%d)\nmount point: %s(%d)\n", a.devId, a.devname, a.nameLen, a.devfileSys, a.fileSysLen, a.devMntPoint, a.mntPointLen);
    return 0;   
}
